package com.heima.a07_demo.server.mapper;

import com.heima.a07_demo.pojo.dto.DoctorRegisterDTO;
import com.heima.a07_demo.pojo.entity.Doctor;
import com.heima.a07_demo.pojo.vo.DoctorVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface DoctorMapper {

    /*
* 新增医生
* */
    @Insert("insert into  doctor (name, username, password, phone_number,department, doctor_title,email) " +
            "VALUES " +
            "(#{name},#{username},#{password},#{phoneNumber},#{department},#{doctorTitle},#{email})")
    void insert(Doctor doctor);


    /*
    * 根据id查询医生信息
    * */
    @Select("select * from doctor where doctor_id=#{id}")
    Doctor getById(Long id);

    /*
    * 修改医生相关信息
    * */
    void update(Doctor doctor);

    /*
     * 根据id查询医生图片路径
     * */
    @Select("select image from doctor where doctor_id=#{id}")
    String getImageById(Long id);

    /*
     * 修改头像
     * */
    @Update("update doctor set image=#{filepath} where doctor_id=#{id}")
    void updateImage(String filepath, Long id);

    /*
    * 保存新密码
    * */
    @Update("update doctor set password=#{newPassword} where doctor_id=#{id}")
    void savePassword(String newPassword, Long id);
}
